// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../Components"

AndroidItem {
    id: _root
    width: 720 * viewScale
    height: 1134 * viewScale

    property string lockScreenPath: ""          //ロックスクリーン

    signal clicked(int key)
    signal unlocked()

    Image {
        anchors.fill: parent
        source: _root.lockScreenPath
        clip: true
        cache: false
        fillMode: Image.PreserveAspectCrop
        smooth: true
    }

    MouseArea{
        anchors.fill: parent
        acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton

        onPressed: {
            _quickCircleLauncher.startCircleAnime();
        }
    }

    //ハンドルとか
    QuickCircleLauncher{
        id: _quickCircleLauncher
        anchors.horizontalCenter: parent.horizontalCenter
        y: 640 * viewScale
        viewScale: _root.viewScale

        onUnlocked: {
            _root.unlocked();
        }
    }


    ImageClock{
        id: _clock
        y: 70 * viewScale
        height: 82 * viewScale
        anchors.right: parent.right
        anchors.rightMargin: 90 * viewScale

        clockNumberWidth: height
        clockColonWidth: 26 * viewScale
        spacing: 12 * viewScale

        numberPics: new Array("images/lock_num_l_0.png"
            , "images/lock_num_l_1.png"
            , "images/lock_num_l_2.png"
            , "images/lock_num_l_3.png"
            , "images/lock_num_l_4.png"
            , "images/lock_num_l_5.png"
            , "images/lock_num_l_6.png"
            , "images/lock_num_l_7.png"
            , "images/lock_num_l_8.png"
            , "images/lock_num_l_9.png"
                    )
        colonPic: "images/lock_num_l_c.png"
    }

    //カレンダー
    LockScreenCalendar{
        id: _calendar
        x: 473 * viewScale
        y: 185 * viewScale
        numberPics: new Array("images/lock_num_s_0.png"
                    , "images/lock_num_s_1.png"
                    , "images/lock_num_s_2.png"
                    , "images/lock_num_s_3.png"
                    , "images/lock_num_s_4.png"
                    , "images/lock_num_s_5.png"
                    , "images/lock_num_s_6.png"
                    , "images/lock_num_s_7.png"
                    , "images/lock_num_s_8.png"
                    , "images/lock_num_s_9.png"
                    )
        weekdayPics: new Array("images/lock_week_sun.png"
                               , "images/lock_week_mon.png"
                               , "images/lock_week_tsu.png"
                               , "images/lock_week_wed.png"
                               , "images/lock_week_thu.png"
                               , "images/lock_week_fri.png"
                               , "images/lock_week_sat.png"
                               )
        yearStrPic: "images/lock_year.png"
        monthStrPic: "images/lock_week_mon.png"
        dayStrPic: "images/lock_week_sun.png"
        lcStrPic: "images/lock_calendar_lC.png"
        rcStrPic: "images/lock_calendar_RC.png"
    }

    //充電不要
    Image{
        id: _charge
        width: 102 * viewScale
        height: 24 * viewScale
        x: 525 * viewScale
        y: 220 * viewScale
        smooth: true
        source: "images/lock_charge_full.png"
    }

    // SIMなし
    Image{
        width: 542 * viewScale
        height: 28 * viewScale
        anchors.horizontalCenter: parent.horizontalCenter
        y: 1080 * viewScale
        smooth: true
        source: "images/lock_none_sim_message.png"
    }


    states: [
        State {
            name: "Land"
            when: !isPortrait
            PropertyChanges {
                target: _quickCircleLauncher
                x: _root.width - _quickCircleLauncher.width - 54 * viewScale
            }
            AnchorChanges{
                target: _quickCircleLauncher
                anchors.horizontalCenter: null
                anchors.verticalCenter: parent.verticalCenter
            }
            PropertyChanges{
                target: _clock
                y: _root.height / 2 - _clock.height / 2
                anchors.rightMargin: _root.width / 2 + 90 * viewScale
            }
            PropertyChanges{
                target: _calendar
                x: 350 * viewScale
                y: _root.height / 2 + _clock.height / 2 + 10 * viewScale
            }
            PropertyChanges{
                target: _charge
                x: 400 * viewScale
                y: _root.height / 2 + _clock.height / 2 + 40 * viewScale
            }
        }
    ]
}
